/**
 * 
 */
package com.avsa.contratacion.model.dao.jpa;

import java.util.Date;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import com.avsa.contratacion.model.Adenda;
import com.avsa.contratacion.model.dao.AdendaContratoDAO;


public class JPAAdendaContratoDAO implements AdendaContratoDAO {
	
	private EntityManager em;
	
	public JPAAdendaContratoDAO(EntityManager em){
		this.em=em;
	}
	
	public List<Adenda> findAll() {
		Query query=em.createQuery("Select o From Adenda o");
		return query.getResultList();
	}

	
	public void insert(Adenda a) {
		
		em.getTransaction().begin();
		em.persist(a);
		em.flush();
		em.getTransaction().commit();
	}
}